package com.cloudptt.wp.ui.more;
//Download by htp://www.codefans.net

import com.cloudptt.api.comm.CommInfo;
import com.cloudptt.api.product.Product;
import com.cloudptt.api.product.log.Log;
import com.cloudptt.api.product.update.UpdateListener;
import com.cloudptt.wp.R;
import com.cloudptt.wp.ScreenManager;
import com.cloudptt.wp.SysApplication;
import com.cloudptt.wp.ui.BaseActivity;
import com.cloudptt.wp.utils.Common;
import com.mcptt.config.local.SysConfig;
import com.mcptt.config.model.BootStrapSvrInfo;
import com.mcptt.config.model.McIdInfo;

import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

public class VersionInfoActivity extends BaseActivity implements UpdateListener {
	@Override
	public void onCreate(Bundle savedInstanceState) {
		Window window = getWindow();
		window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
		window.setStatusBarColor(getResources().getColor(R.color.gradient_end));
		super.onCreate(savedInstanceState);
		setContentView(R.layout.version);
		ImageView infoIv = (ImageView) findViewById(R.id.infoIv);
		infoIv.setVisibility(View.GONE);

		initNotificationLayout();

		TextView versionText = (TextView)findViewById(R.id.versionText);
		String str = Common.getVersion(VersionInfoActivity.this);
		versionText.setText(str);

		TextView tv = (TextView) findViewById(R.id.titleTv);
		tv.setText(R.string.about_us);

		Button checkVersionBtn = (Button) findViewById(R.id.checkVersionBtn);
		checkVersionBtn.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				SysApplication app = ((SysApplication) getApplicationContext());
				Product product = app.getProduct();
				{
					product.checkCurVersion(VersionInfoActivity.this,true,false,VersionInfoActivity.this);
				}
			}
		});
	}

	@Override
	public void onUpdate(int state) {
		Log.debug(this.getClass(), "onUpdate state = " + state);
//		if(UpdateListener.UpdateInstall == state)
//		{
//			ScreenManager.getScreenManager().popAllActivity();
//		}
	}

}
